<template>
  <view class="ssguiz-container">
    <rich-text :nodes="richTextContent" class="rich-text-content" />
  </view>
</template>

<script>
export default {
  data() {
    return {
      richTextContent: "",
      groupType : ''
    }
  },
    onLoad(e) {
    console.log('-----------1------22-----', e.group)
    this.groupType = e.group
    this.fetchNews();
  },
  methods: {
    async fetchNews() {
      let urlstr;
      if (this.groupType == 'AB组') {
        urlstr = 'http://chaoxiang.scoringchina.com/index/api/richeng_ab';
      } else { 
        urlstr = 'http://chaoxiang.scoringchina.com/index/api/richeng_cd';
      }
      try {
        const res = await uni.request({
          url: urlstr,
          method: 'GET'
        });
        if(res && res.data && res.data.code === 1) {
          this.richTextContent = res.data.data.content || "";
        } else {
          console.error('获取数据失败', res[1]);
        }
      } catch (error) {
        console.error('请求异常', error);
      }
    },
  
  }
}
</script>

<style scoped>
.ssguiz-container {
  display: flex;
  flex-direction: column;
  background: #fff;
  padding: 0;
}
.ssguiz-img {
  width: 100vw;
  display: block;
  margin: 0 auto;
}
/* 富文本容器 */
.ssguiz-container ::v-deep p {
  text-align: center; /* 居中 */
  margin: 0;
  padding: 0;
}

.ssguiz-container ::v-deep img {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  display: block;
  margin: 0 auto;
}
</style>